﻿using System.Collections.Generic;
using System.Diagnostics;
using NHibernate.Sidekick.Data.Domain;
using NHibernate.Validator;
using NHibernate.Validator.Constraints;

namespace NHibernate.Sidekick.ConsoleTests.Domain.Entities
{
    [DebuggerDisplay("{Id} - {Name}")]
    public class Store : DomainObject<Store, int>
    {
        [NotNullNotEmpty]
        [Length(45)]
        public virtual string Name { get; set; }
        public virtual IList<Product> Products { get; set; }
        public virtual IList<Employee> Staff { get; set; }

        public Store()
        {
            Products = new List<Product>();
            Staff = new List<Employee>();
        }

        public virtual void AddProduct(Product product)
        {
            product.StoresStockedIn.Add(this);
            Products.Add(product);
        }

        public virtual void AddEmployee(Employee employee)
        {
            employee.Store = this;
            Staff.Add(employee);
        }
    }
}